pub fn convert_base(num_str: &str, to_base: u32) -> String {
    num_str
        .split_once("(")
        .and_then(|(num, radix)| {
            let radix = radix.trim_end_matches(")").parse().ok()?;
            let mut num = u32::from_str_radix(num, radix).ok()?;
            let mut result = String::new();
            while num > 0 {
                let remainder = num % to_base;
                let digit = if remainder < 10 {
                    std::char::from_digit(remainder, 10).unwrap()
                } else {
                    (b'a' + (remainder - 10) as u8) as char
                };
                result.insert(0, digit);
                num /= to_base;
            }
            if result.is_empty() {
                result.push('0');
            }
            Some(result)
        })
        .unwrap_or_else(|| num_str.to_string())
}
